package cn.cs.client;

import cn.cs.config.CsConfiguration;
import cn.cs.fallback.AgentInvoiceFallBack;
import cn.cs.fallback.CsPartsFallBack;
import cn.cs.pojo.CsParts;
import cn.cs.pojo.CsPartsAttribute;
import cn.cs.pojo.CsPartsQrCode;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * Created by yuexl
 */
@FeignClient(name = "cs-user-provider", configuration = CsConfiguration.class, fallback = CsPartsFallBack.class)
public interface CsPartsClient {

    @RequestMapping(value = "/getCsPartsById", method = RequestMethod.POST)
    public CsParts getCsPartsById(@RequestParam("id") String id) throws Exception;

    @RequestMapping(value = "/getCsPartsByName", method = RequestMethod.POST)
    public CsParts getCsPartsByName(@RequestParam("parts_name") String parts_name) throws Exception;

    @RequestMapping(value = "/getCsPartsByFactoryId", method = RequestMethod.POST)
    public List<CsParts> getCsPartsByFactoryId(@RequestParam("factory_id") String factory_id, @RequestParam("factory_name") String factory_name, @RequestParam("parts_name") String parts_name) throws Exception;

    @RequestMapping(value = "/getCsPartsListByMap", method = RequestMethod.POST)
    public List<CsParts> getCsPartsListByMap(@RequestBody Map<String, Object> param) throws Exception;

    @RequestMapping(value = "/getCsPartsCountByMap", method = RequestMethod.POST)
    public Integer getCsPartsCountByMap(@RequestBody Map<String, Object> param) throws Exception;

    @RequestMapping(value = "/insertCsParts", method = RequestMethod.POST)
    public Integer insertCsParts(@RequestBody CsParts csParts) throws Exception;

    @RequestMapping(value = "/addPartsAttribute", method = RequestMethod.POST)
    public Integer addPartsAttribute(@RequestBody CsPartsAttribute partsAttribute) throws Exception;

    @RequestMapping(value = "/updateCsParts", method = RequestMethod.POST)
    public Integer updateCsParts(@RequestBody CsParts csParts) throws Exception;

    @RequestMapping(value = "/updatePartsAttribute", method = RequestMethod.POST)
    public Integer updatePartsAttribute(@RequestBody CsPartsAttribute partsAttribute) throws Exception;

    @RequestMapping(value = "/deleteCsPartsById", method = RequestMethod.POST)
    public Integer deleteCsPartsById(@RequestParam("id") String id) throws Exception;

    @RequestMapping(value = "/deleteCsPartsImgByPartsId", method = RequestMethod.POST)
    public Integer deleteCsPartsImgByPartsId(@RequestParam("partsId") String partsId) throws Exception;

    @RequestMapping(value = "/deletePartsAttribute", method = RequestMethod.POST)
    public Integer deletePartsAttribute(@RequestParam("id") String id) throws Exception;

    @RequestMapping(value = "/insertCsPartsImgList", method = RequestMethod.POST)
    public Integer insertCsPartsImgList(@RequestBody List<Map<String, Object>> list)throws Exception;

    @RequestMapping(value = "/insertCsPartsQRcodeList", method = RequestMethod.POST)
    public Integer insertCsPartsQRcodeList(@RequestBody List<Map<String, Object>> list)throws Exception;

    @RequestMapping(value = "/updateCsPartsQRcode", method = RequestMethod.POST)
    public Integer updateCsPartsQRcode(@RequestBody Map<String, Object> map)throws Exception;

    @RequestMapping(value = "/getCsPartsQRcodeListByMap", method = RequestMethod.POST)
    public List<Map<String, Object>> getCsPartsQRcodeListByMap(@RequestBody Map<String, Object> param) throws Exception;

    @RequestMapping(value = "/getCsPartsQRcodeCountByMap", method = RequestMethod.POST)
    public Integer getCsPartsQRcodeCountByMap(@RequestBody Map<String, Object> param) throws Exception;

    @RequestMapping(value = "/getHistoryByQRcode", method = RequestMethod.POST)
    public List<Map<String, Object>> getHistoryByQRcode(@RequestBody String QRcode) throws Exception;

    @RequestMapping(value = "/getPartsByQRcode", method = RequestMethod.POST)
    public Map<String, Object> getPartsByQRcode(@RequestBody String QRcode) throws Exception;

    @RequestMapping(value = "/getPartsSellNum", method = RequestMethod.POST)
    public List<Map<String, Object>> getPartsSellNum(@RequestBody Map<String, Object> param) throws Exception;

    @RequestMapping(value = "/getPartsSellNumCount", method = RequestMethod.POST)
    public Integer getPartsSellNumCount(@RequestBody Map<String, Object> param) throws Exception;

    @RequestMapping(value = "/getQrcodeMax", method = RequestMethod.POST)
    public Long getQrcodeMax(@RequestParam("partsId") String partsId) throws Exception;

    @RequestMapping(value = "/getPartsQrcodeList", method = RequestMethod.POST)
    public List<Map<String, Object>>  getPartsQrcodeList(@RequestParam("partsId") String partsId, @RequestParam("startCode") String startCode, @RequestParam("endCode") String endCode) throws Exception;

    @RequestMapping(value = "/getPartsQrcodeListEntity", method = RequestMethod.POST)
    public List<CsPartsQrCode>  getPartsQrcodeListEntity(@RequestParam("partsId") String partsId, @RequestParam("startCode") String startCode, @RequestParam("endCode") String endCode) throws Exception;
}

